﻿/*********************弘石项目三组************************
*  功能描述:系统管理-角色权限设置
*  作者：黄启轩
*  时间：2020-12-20
*  修改人：黄启轩
*  修改时间：2020-12-20
*********************弘石项目三组************************/
using Hong.Common.RabbitMQ;
using Hong.IRepository.IRepository_SystemSettings.RBAC;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace WeHongshibApI.Controllers.Controllers_SystemSettings.RBAC
{
    [ApiExplorerSettings(GroupName = "SystemSettings")]
    [Route("api/[controller]")]
    [ApiController]
    public class RoleController : ControllerBase
    {
        #region 构造器API注入
        private readonly IRole  _role;
        public RoleController(IRole role)
        {
            _role = role;
        }

        #endregion

        #region 添加角色
        [HttpPost, Route("AddUR")]
        public IActionResult AddUR(string[] PersonnelId, string RoleNmae)
        {
            var result = _role.AddUR(PersonnelId, RoleNmae);
            return Ok(result);
        }
        #endregion

        #region 显示角色
        [HttpGet, Route("GetRole")]
        public IActionResult GetRole()
        { 
            var role = _role.GetRole();
            return Ok(role);
        }
        #endregion

        #region 加载全部用户
        [HttpGet, Route("GetPerson")]
        public IActionResult GetPerson()
        { 
            var role= _role.GetPerson();
            return Ok(role);
        }
        #endregion

        #region 反填角色
        /// <summary>
        /// opoppo
        /// </summary>
        /// <param name="RoleId"></param>
        /// <returns></returns>
        [HttpGet, Route("GURole")]
        public IActionResult GURole(string RoleId)
        { 
            var role=_role.GURole(RoleId);
            return Ok(role);
        }
        #endregion

        #region 修改角色
        [HttpPost, Route("UPRole")]
        public IActionResult UPRole(string[] PersonnelId, string RoleNmae, string RoleId)
        { 
            var role=_role.UPRole(PersonnelId, RoleNmae, RoleId);
            return Ok(role);
        }
        #endregion

        #region 删除角色
        [HttpDelete, Route("DelRole")]
        public IActionResult DelRole(string RoleId)
        { 
            var role=_role.DelRole(RoleId);
            return Ok(role);
        }
        #endregion


    }
}
